/* ===================================
Michal Kowalczyk
2010 EZI
==================================== */

#pragma once
// entites.h - the model layer of MVC

#include "engine.h"
#include "mos3d.h"

class BaseEntity: public IEntity {
private:
protected:
	int m_id;
	PositionPtr m_position;
	int region;
public:
	BaseEntity(EntityID id): m_position(new Position3D()), m_id(id), region(0) {};
	BaseEntity(EntityID id, int _reg): m_position(new Position3D()), m_id(id), region(_reg) {};
	virtual ~BaseEntity() {};
	int getId() 
	{ 
		return m_id;
	}
	virtual Position3D getPosition3D() 
	{ 
		return *m_position; 
	}
	void setPosition3D(float x, float y, float z) 
	{
		m_position->x = x; 
		m_position->y = y;
		m_position->z = -z; 
	}
	void setPosition3D(float x, float z)
	{
		m_position->x = x;
		m_position->y = Renderer::Instance().getMOS_Structure()->getHeight(x,z)+1.0f;
		m_position->z = -z;
	}
	void setHeight(float y)
	{
		m_position->y = y;
	}
	void setPosition3D(float & x, float & y, float & z, float & angle, float & rotx, float & roty, float & rotz)
	{
		m_position->x = x; 
		m_position->y = y;
		m_position->z = -z; 
		m_position->angle = angle;
		m_position->rotx = rotx;
		m_position->roty = roty;
		m_position->rotz = rotz;
	}
	void setPosition3D(float & angle, float rotx, float roty, float rotz)
	{
		m_position->angle = angle;
		m_position->rotx = rotx;
		m_position->roty = roty;
		m_position->rotz = rotz;
	}
	virtual std::string getType() = 0;
	virtual void update() = 0;

	virtual void setRegion(int r) { region = r; }
	virtual int getRegion() { return region; }
};

class InversionLayer: public BaseEntity
{
private:
	static const std::string m_type;
	float width;
public:
	InversionLayer(int id): width(0.0f), BaseEntity(id) {}
	~InversionLayer() {}
	std::string getType()
	{
		return m_type;
	}
	void setWidth(float _width) { width = _width; }
	float getWidth() { return width; }
	void update () {};

};

class Electron: public BaseEntity
{
private:
	static const std::string m_type;
public:
	Electron(int id, int _reg): BaseEntity(id, _reg) {}
	~Electron() {}
	std::string getType()
	{
		return m_type;
	}
	void update() {};
};

class Hole: public BaseEntity
{
private:
	static const std::string m_type;
public:
	Hole(int id, int _reg): BaseEntity(id, _reg) {}
	~Hole() {}
	std::string getType()
	{
		return m_type;
	}
	void update() {};
};

